CMAKE_MINIMUM_REQUIRED(VERSION 3.0)

SET(CHANNEL Channel.cpp)
# SET(POLLER Poller.cpp)
SET(EVENTLOOP EventLoop.cpp)
SET(TIMER Timer.cpp)
SET(TIMERQUEUE TimerQueue.cpp)
SET(INETADDRESS InetAddress.cpp)
SET(SOCKOPT SockOpt.cpp)
SET(SOCKET Socket.cpp)
SET(ACCEPTOR Acceptor)
SET(TCPCONNECTION TcpConnection.cpp)
SET(TCPSERVER TcpServer.cpp)
SET(EVENTLOOPTHREAD EventLoopThread.cpp)
SET(EVENTLOOPTHREADPOOL EventLoopThreadPool.cpp)
SET(CONNECTOR Connector.cpp)
SET(TCPCLIENT TcpClient.cpp)
SET(IPOLLER Pollers/IPoller.cpp)
SET(POLLER Pollers/Poller.cpp)
SET(EPOLLER Pollers/EPoller.cpp)

ADD_LIBRARY(net 
    ${CHANNEL} 
    ${POLLER} 
    ${EVENTLOOP} 
    ${TIMER} 
    ${TIMERQUEUE} 
    ${INETADDRESS} 
    ${SOCKOPT} 
    ${SOCKET} 
    ${ACCEPTOR} 
    ${TCPCONNECTION} 
    ${TCPSERVER} 
    ${EVENTLOOPTHREAD} 
    ${EVENTLOOPTHREADPOOL}
    ${CONNECTOR}
    ${TCPCLIENT}
    ${IPOLLER}
    ${POLLER}
    ${EPOLLER}
)

INSTALL(FILES Channel.h EventLoop.h Poller.h DESTINATION ${PROJECT_SOURCE_DIR}/net/include)
INSTALL(TARGETS net ARCHIVE DESTINATION ${PROJECT_SOURCE_DIR}/lib)